from django.db import models
from login.models import *


#楼
class Tower(models.Model):
    '''
        @author:xxx
        @date:xxx
    '''

    user = models.ForeignKey(User, on_delete=models.CASCADE, null=True, blank=True)

    #楼名(如:教学楼.宿舍楼等)
    tower_name = models.CharField(max_length = 200,unique=True)
    

#楼层
class Floor(models.Model):

    user = models.ForeignKey(User, on_delete=models.CASCADE, null=True, blank=True)
    tower = models.ForeignKey(Tower, on_delete=models.CASCADE)

    #层数(如: 5)
    floor_num = models.CharField(max_length = 10)
    
#房间
class Room(models.Model):

    user = models.ForeignKey(User, on_delete=models.CASCADE, null=True, blank=True)
    floor = models.ForeignKey(Floor, on_delete=models.CASCADE)

    #房间数(如:311西)
    room_num = models.CharField(max_length = 10)
